package com.zbkj.admin.controller.region;

import com.zbkj.common.region.home.CitySaleRankResponse;
import com.zbkj.common.region.home.MerchantSaleRankResponse;
import com.zbkj.common.region.home.indicator.RegionHomeIndicatorResponse;
import com.zbkj.common.result.CommonResult;
import com.zbkj.service.service.adminregion.IRegionHomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 区域端主页控制器
 * +----------------------------------------------------------------------
 */
@Slf4j
@RestController
@RequestMapping("api/admin/region/statistics/home")
@Api(tags = "区域端-主页控制器")
public class RegionHomeController {

    @Autowired
    private IRegionHomeService regionHomeService;


    @ApiOperation(value = "首页数据看板指标")
    @GetMapping(value = "/homeIndicator")
    public CommonResult<RegionHomeIndicatorResponse> getHomeIndicator() {
        RegionHomeIndicatorResponse homeIndicator = regionHomeService.getHomeIndicator();
        return CommonResult.success(homeIndicator);
    }


    @ApiOperation(value = "地区销售排行榜")
    @GetMapping(value = "/getCitySaleRank")
    public CommonResult<List<CitySaleRankResponse>> getCitySaleRank() {
        return CommonResult.success(regionHomeService.getCitySaleRank());
    }


    @ApiOperation(value = "商户销售排行榜")
    @GetMapping(value = "/getMerchantSaleRank")
    public CommonResult<List<MerchantSaleRankResponse>> getMerchantSaleRank() {
        return CommonResult.success(regionHomeService.getMerchantSaleRank());
    }
}



